package com.example.my.meila.view.adapter.beautyadapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.my.meila.R;
import com.example.my.meila.common.image.ImageLoader;
import com.example.my.meila.constast.Constast;
import com.example.my.meila.entity.MakeUp;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by My on 2016/11/1.
 */
public class MakeUpChildConAdapter extends RecyclerView.Adapter<MakeUpChildConAdapter.ViedoViewHolder> {

    private Context context;
    private List<MakeUp.DataBean.FeedsBean> data;

    public MakeUpChildConAdapter(Context context, List<MakeUp.DataBean.FeedsBean> data) {
        this.context = context;
        this.data = data;
    }

    @Override
    public ViedoViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViedoViewHolder(LayoutInflater.from(context).inflate(R.layout.item_makeup_video, null));
    }

    @Override
    public void onBindViewHolder(ViedoViewHolder holder, int position) {


                ImageLoader.getInstance().transformationsImage(context, Constast.PUBLIC_URL + data.get(position).getUser().getAvatar(),  holder.makeIv1);
                ImageLoader.getInstance().display(context, Constast.PUBLIC_URL + data.get(position).getUser().getNew_type_icon(),  holder.makeIv2);
                holder.makeTv1.setText( data.get(position).getUser().getNickname());

              ImageLoader.getInstance().display(context, Constast.PUBLIC_URL + data.get(position).getFeed().getImg_v4().getImg(), holder.makeIv3);
              holder.makeTv3.setText( data.get(position).getFeed().getSummary());
              holder.makeTv4.setText( data.get(position).getLike_count() + "");
              holder.makeTv5.setText( data.get(position).getParticipate_count() + "");

             holder.makeRed1.setText(data.get(position).getFeed().getVtalk_tags().get(0).getTitle());
             holder.makeRed2.setText(data.get(position).getFeed().getVtalk_tags().get(1).getTitle());

    }

    @Override
    public int getItemCount() {
        return data.size();
    }

    class ViedoViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.make_iv1)
        ImageView makeIv1;
        @BindView(R.id.make_iv2)
        ImageView makeIv2;
        @BindView(R.id.make_tv1)
        TextView makeTv1;
        @BindView(R.id.make_tv2)
        TextView makeTv2;
        @BindView(R.id.make_rl)
        RelativeLayout makeRl;
        @BindView(R.id.make_iv3)
        ImageView makeIv3;
        @BindView(R.id.make_tv3)
        TextView makeTv3;
        @BindView(R.id.make_red1)
        TextView makeRed1;
        @BindView(R.id.make_red2)
        TextView makeRed2;
        @BindView(R.id.make_tv4)
        TextView makeTv4;
        @BindView(R.id.make_tv5)
        TextView makeTv5;

        public ViedoViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this,itemView);
        }
    }
}
